package com.example.myapplication3

import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.LinearLayout
import android.widget.Toast

class TitleLayout(context: Context, attrs: AttributeSet): LinearLayout(context, attrs) {

    init {
        LayoutInflater.from(context).inflate(R.layout.title_layout, this)
        val titleBack: Button = findViewById(R.id.title_back)
        val titleEdit: Button = findViewById(R.id.title_edit)

        titleBack.setOnClickListener{
            val activity = context as Activity
            activity.finish()
        }

        titleEdit.setOnClickListener {
            Toast.makeText(context,"Clicked the edit button!", Toast.LENGTH_LONG).show()
        }
    }


}